package com.itheima.health.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.health.dao.MenuDao;
import com.itheima.health.dao.RoleDao;
import com.itheima.health.dao.UserDao;
import com.itheima.health.pojo.Role;
import com.itheima.health.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @autahor: csl
 * @date: 2019/7/29
 * @description:
 * @version:1.0
 */
@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    private UserDao userDao;
    @Autowired
    private RoleDao roleDao;
    @Autowired
    private MenuDao menuDao;
    @Transactional
    @Override
    public List<Map<String, Object>> findMenuListByusername(String username) {
        Role role=  roleDao.findRoleIdByusername(username);
        List<Integer> menuList=menuDao.findMenuByRoleId(role.getId())  ;

        List<Map<String,Object>>fuMenu= menuDao.findFuMenu(menuList);
        return fuMenu;
    }
}
